package com.Threecharacters.inherit_.Override.OverrideExerise;

//2.编写一个Student类，继承person类，增加id，score属性/private
//以及构造器，定义say方法(返回自我介绍信息)
public class Student  extends Person {

    private int id;
    private double score;

    //原因是在你写子类之时有一个隐藏的super();但是Person显示定义一个带参构造器
    //这个带参构造器覆盖掉父类原来的空构造器，导致子类super();失效
    public Student(String name, int age) {
        super(20,"无名英雄");
    }

    public String say(int id,double score) {

        this.id = id;
        this.score = score;
        return super.say() +" Hello "+ this.id + " got " + this.score;
    }//方法覆盖现象出现


}
